/**
 * 历史版本信息 引用JS文件
 */

//初始化页面加载
$(function(){
	pageList();
});

function pageList(){
	
	$.ajax({
		url : "../self/krviewInfo",
		type : "post",
		dataType : "json",
		data : {"uniqueCode":uniqueCode},
		success : function(data){
			console.log(data);
			if(data == null || data == -1){
				return;
			}
			$("#sp_name").html(data.obj.PERSON_LIABLE_NAME);
			$("#sp_time").html(okrTime(data.obj.O_YEAR,data.obj.O_QUARTER,data.obj.O_MONTH));
			$("#sp_org").html("所属组织："+data.obj.OWNER_DEPTNAME);
			$("#sp_post").html("职务："+data.obj.PERSON_LIABLE_POSTNAME);
			$("#sp_type").html("OKR类别："+oTeam(data.obj.OKR_TYPE));
			$("#sp_team").html("所属团队："+data.obj.OWNER_TEAMNAME);
			$("#sp_code").html(data.obj.O_CODE);
			$("#sp_code1").html(data.obj.O_CODE);
			$("#sp_score").html(data.obj.O_SCORE_SUPERIOR);		
			$("#sp_state").html(data.obj.SCORE_STATE);		
			$("#sp_content").html(data.obj.O_DEFINITION);	
			
			$("#review").attr("href","../self/review?uniqueCode="+data.obj.O_UNIQUE_ID_CODE);		
			$("#score").attr("href","../self/score?uniqueCode="+data.obj.O_UNIQUE_ID_CODE);		
			$("#version").attr("href","../self/version?uniqueCode="+data.obj.O_UNIQUE_ID_CODE);		
			$("#link").attr("href","../self/link?uniqueCode="+data.obj.O_UNIQUE_ID_CODE);
			
			if(data.krs.length == 0){
				$("#list").html('<div class="mui-card" style=""><div class="mui-card-footer"><p class="index-status" style="text-align:center; width:100%;margin-top:3%;">暂无信息</p></center></div>');
				return;
			}
			$("#list").html("");
			var str = "";  
			$.each(data.krs,function(n,value) {
				str += '<div class="mui-card" style="">';
				str += '<div class="mui-card-header">';
				str += '<span class="bold">'+value.CODE_NAME+'</span> <span style="float: right; font-size: 14px; color: #666;">评分： ';
				str += oColor(value.KR_SCORE_SUPERIOR);
				str += '</span>';
				str += '</div>';
				str += '<div class="mui-card-content">';
				str += '<div class="mui-card-content-inner re-bold2">';
				str += '<p><span>定义：</span>'+value.KR_DEFINITION+'</p>';
				str += '<p><span>行动计划：</span>'+value.ACTION_PLAN+'</p>';
				str += '</div></div></div>';
			});  
			
			$("#list").html(str);
		}
	});
}